@using OrchardCore.ContentManagement
@using StatCan.OrchardCore.VueForms.Models
@inject OrchardCore.ContentManagement.Display.IContentItemDisplayManager ContentItemDisplayManager
@inject OrchardCore.DisplayManagement.ModelBinding.IUpdateModelAccessor updateModelAccessor

@{
  var contentItem = (ContentItem)Model.ContentItem;
  var formPart = contentItem.As<VueForm>();
}

@if (formPart.Enabled?.Value == true)
{  
  Model.Metadata.Alternates.Clear();
  @if(!string.IsNullOrEmpty(formPart.RenderAs?.Text))
  {
    Model.Metadata.Type = "VueForm__" + formPart.RenderAs?.Text;
    @await DisplayAsync(Model)
  }else {
    Model.Metadata.Type = "VueForm__CommonTemplate";
    @await DisplayAsync(Model)
  } 
}
else
{
  @await DisplayAsync(Model.Content.Named("VueForm-DisabledHtml"))
}
